﻿<!DOCTYPE html>
<html>
<head>
    <title>商品订单</title>
</head>
<body>
    <div>
        <section data-role="page" id="goodorders_main">
            <div style="padding:5px;" id="goodorders_content">
                <!--订单信息-->
                <ul data-role="listview" id="goodsordersinfo">
               	    <li data-role="list-divider">填写并审核订单信息</li>

                    <li>
                        <div class="meminfo">
                            <fieldset>
                               <label for="memname">姓名</label>
                                <input type="text" id="memname" runat="server" placeholder="请输入您的姓名" />
                                <label for="telnumber">手机号码</label>
                                <input type="text" id="telnumber" runat="server" placeholder="请输入您的手机号码" />
                                <label for="address">地址</label>
                                <textarea class="address" id="address" runat="server" placeholder="请输入您的收货地址" style="height:100px;font-size:13px;"></textarea>
                            </fieldset>
                        </div>
                    </li>
                </ul>

                
                <!--商品清单-->
                <ul data-role="listview" id="goodsinventory">
                    <li data-role="list-divider">商品清单</li>

                    <li>
                        <div class="detail-main">
                            <asp:Repeater runat="server" ID="rptGoodsinventory">
                                <ItemTemplate>
                                    <!--Repeater Start-->
                                    <div class="detail_row">
                	                    <!--left-->
                                        <div class="row_item row_item-left">
                                            <img src="<%#Eval("MicroGoodsPicture") %>" />
                                        </div>
                                        <!--right-->
                                        <div class="row_item row_item-right">
                                            <strong style="font-size:14px;"><%#Eval("MicroGoodsName")%></strong>
                                            <span style="margin-top:5px 0;display:block;"> 会 员 价：&nbsp;&nbsp;<span class="discountPrice"><%#Convert.ToDecimal(Eval("MicroPrice")).ToString("0.00")%></span>元</span>
                                            <span style="display:block;">购买数量：<%#Eval("ConvertNumber") %></span>
                                            <span style="display:block;">小计金额：&nbsp;&nbsp;<span class="discountPrice"><%#Convert.ToDecimal(Eval("Subtotal")).ToString("0.00")%></span>元</span>
                                        </div>
                                        <!--right end-->
                                    </div>
                
                                    <hr />
                                    <!--Repeater End-->
                                </ItemTemplate>
                            </asp:Repeater>
                            <span id="total">应付总金额：￥<span id="totalMoney" runat="server"></span></span>
                        </div>
                    </li>
                </ul>
                <a data-role="button" data-theme="a" id="aGoodOrderSubmit">提交订单</a>
                <a data-role="button" data-theme="a" id="aGoodOrderSubmit2" href="#goodspay" data-load="goodspay.aspx" style="display:none;"></a>
                <input type="hidden" runat="server" id="MicroPoint" />
            </div>
            
            <script type="text/javascript">
                $("#aGoodOrderSubmit").click(function () {
                    $("#aGoodOrderSubmit").attr('disabled', "true");
                    var memname = $.trim($("#memname").val());
                    var telnumber = $.trim($("#telnumber").val());
                    var address = $.trim($("#address").val());
                    if (memname == "") { alert("请输入您的姓名!"); return; }
                    if (telnumber == "") { alert("请输入您的手机号码!"); return; } else { if (!telnumber.IsMobile()) { alert("您输入的手机号码格式有误"); return; } }
                    if (address == "") { alert("请输入您的收货地址!"); return; }

                    $.get("../Service/AjaxService.ashx?Method=GoodApplication",
                    {
                        "MemID": getCookie("uid"),
                        "MemName": memname,
                        "ExchangeTelePhone": telnumber,
                        "ExchangeAddress": address,
                        "MicroOrderDiscountMoney": $("#totalMoney").text(),
                        "MicroOrderPoint": $("#MicroPoint").val()
                    }
                    , function (text) {
                        if (text == "0") { alert("系统有点繁忙，提交失败！"); } else {
                            alert("申请成功!");
                            $("#aGoodOrderSubmit2").attr("data-load", "goodspay.aspx?MicroOrderID=" + text);
                            //清空localStorage对象
                            var strKey = "";
                            var getData = "";
                            for (var i = localStorage.length - 1; i >= 0; i--) {
                                strKey = localStorage.key(i);
                                if (strKey.substring(0, 5) == "good_") {
                                    getData = JSON.parse(xxl.xd.getValue(strKey));
                                    localStorage.removeItem(getData.Type);
                                }
                            }
                            //清空Cookie
                            setCookie("goodlist", "");
                            $("#aGoodOrderSubmit2").click();
                        }
                        $("#aGoodOrderSubmit").removeAttr("disabled");
                    }, "text")
                })
            </script>

            <footer data-role="footer" data-position="fixed" id="goodorders_footer">
                <div data-role="navbar" id="nav-glyphish-example">
                    <ul>
                        <li><a href="#index" data-icon="custom" id="site" >商家网站</a></li>
                        <li><a href="#goodlist" data-load="goodlist.aspx" data-icon="custom" id="buy" class="ui-btn-active">商品购买</a></li>
                        <li><a href="#membershipcard" data-load="membershipcard.aspx" data-icon="custom"  id="card">会员卡</a></li>
                        <li><a href="#giftlist" data-load="giftlist.aspx" data-icon="custom" id="convert">积分兑换</a></li>
                    </ul>
                </div>
            </footer>
        </section>
    </div>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="goodorders.aspx.cs" Inherits="goodorders" EnableViewState="false" %>
